// 定义一个根路由
import {RouteRecordRaw} from "vue-router";


import HOME_PAGE_COM from '@/pages/framework/home/index.vue'

export const LAYOUT = () => import('@/layout/index.vue')
export const ERROR_401 = () => import('@/pages/framework/error/401.vue')
export const ERROR_404 = () => import('@/pages/framework/error/404.vue')
export const ERROR_500 = () => import('@/pages/framework/error/500.vue')


// 404 路由路径
export const NOT_FOUND_URL = '/error/404'


// 根路由
export const PORTAL_ROUTER: RouteRecordRaw = {
    path: '/portal',
    name: 'PORTAL_ROUTER',
    component: LAYOUT,
    meta: {hiddenInMenu: true, hiddenInTab: true},
    children: [
        {
            path: 'home',
            name: 'portal-home',
            component: HOME_PAGE_COM,
            meta: {title: '主页', hiddenInMenu: true, hiddenInTab: true},
        },


    ]


}
export const ROOT_ROUTER2: RouteRecordRaw = {
    path: '/',
    redirect: '/login',
    meta: {hiddenInMenu: true, hiddenInTab: true},
}

// 根路由
export const ROOT_ROUTER: RouteRecordRaw = {
    path: '/',
    name: 'CONSTANT_ROOT',
    component: LAYOUT,
    meta: {hiddenInMenu: true, hiddenInTab: true},
}


export const ERROR_ROUTER: RouteRecordRaw = {
    path: '/error',
    name: 'CONSTANT_ERROR',
    component: LAYOUT,
    meta: {hiddenInTab: true, hiddenInMenu: true},
    children: [
        {
            path: '401',
            name: 'CONSTANT_ERROR_401',
            component: ERROR_401,
            meta: {hiddenInTab: true, hiddenInMenu: true, title: '权限不足警告'},
        },

        {
            path: '404',
            name: 'CONSTANT_ERROR_404',
            component: ERROR_404,
            meta: {hiddenInTab: true, hiddenInMenu: true, title: '页面不存在警告'},
        },

        {
            path: '500',
            name: 'CONSTANT_ERROR_500',
            component: ERROR_500,
            meta: {hiddenInTab: true, hiddenInMenu: true, title: '服务出错警告'},
        },
    ],
}

// 404页

export const NOT_FOUND_ROOTER: RouteRecordRaw = {
    path: '/:pathMatch(.*)*',
    redirect: NOT_FOUND_URL,
    name: 'CONSTANT_NOT_FOUND',
    meta: {title: 'NotFound', hiddenInMenu: true, hiddenInTab: true},
}

// 用户登录路由页

export const LOGIN_ROOTER: RouteRecordRaw = {
    path: '/login',
    name: 'LOGIN_PAGE',
    component: () => import('@/pages/framework/login/index.vue'),
    meta: {
        title: '登录页',
        hiddenInMenu: true,
        hiddenInTab: true,
        enableKeepAlive: false,
    },
}


// 初始化理由页
export const INIT_ROUTER = [ROOT_ROUTER2, ROOT_ROUTER, LOGIN_ROOTER, PORTAL_ROUTER]